package com.ruoyi.shop.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.shop.mapper.ShopAccountMapper;
import com.ruoyi.shop.domain.ShopAccount;
import com.ruoyi.shop.service.IShopAccountService;

/**
 * 账户Service业务层处理
 * 
 * @author jiaodacailei
 * @date 2022-06-12
 */
@Service
public class ShopAccountServiceImpl implements IShopAccountService 
{
    @Autowired
    private ShopAccountMapper shopAccountMapper;

    /**
     * 查询账户
     * 
     * @param id 账户主键
     * @return 账户
     */
    @Override
    public ShopAccount selectShopAccountById(Long id)
    {
        return shopAccountMapper.selectShopAccountById(id);
    }

    /**
     * 查询账户列表
     * 
     * @param shopAccount 账户
     * @return 账户
     */
    @Override
    public List<ShopAccount> selectShopAccountList(ShopAccount shopAccount)
    {
        return shopAccountMapper.selectShopAccountList(shopAccount);
    }

    /**
     * 新增账户
     * 
     * @param shopAccount 账户
     * @return 结果
     */
    @Override
    public int insertShopAccount(ShopAccount shopAccount)
    {
        shopAccount.setCreateTime(DateUtils.getNowDate());
        return shopAccountMapper.insertShopAccount(shopAccount);
    }

    /**
     * 修改账户
     * 
     * @param shopAccount 账户
     * @return 结果
     */
    @Override
    public int updateShopAccount(ShopAccount shopAccount)
    {
        shopAccount.setUpdateTime(DateUtils.getNowDate());
        return shopAccountMapper.updateShopAccount(shopAccount);
    }

    /**
     * 批量删除账户
     * 
     * @param ids 需要删除的账户主键
     * @return 结果
     */
    @Override
    public int deleteShopAccountByIds(Long[] ids)
    {
        return shopAccountMapper.deleteShopAccountByIds(ids);
    }

    /**
     * 删除账户信息
     * 
     * @param id 账户主键
     * @return 结果
     */
    @Override
    public int deleteShopAccountById(Long id)
    {
        return shopAccountMapper.deleteShopAccountById(id);
    }
}
